<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:s="http://jboss.com/products/seam/taglib">

	<h:form>
		<div align="center">
			<strong>#{messages['intro2.attacheddocs']}</strong>
		</div>
		<rich:separator lineType="solid"/>

		<h:panelGroup id="tabla">
			<h:panelGroup rendered="#{empty transactionHelper.attachedFiles}">
				<div align="center">
					<br/>
					<h:outputText value="#{messages['intro2.nodocsattached']}"/>
				</div>
			</h:panelGroup>
			<br />
			<rich:dataTable id="datosTabla" value="#{transactionHelper.attachedFiles}"
					var="file" rowKeyVar="row" rendered="#{not empty transactionHelper.attachedFiles}">
				
				<rich:column>
					<f:facet name="header">#{messages['intro2.description']}</f:facet>
					<h:outputText value="#{file.descripcion}"/>
				</rich:column>

				<rich:column>
					<f:facet name="header">#{messages['txt.type']}</f:facet>
					<h:outputText value="#{messages[file.adminSourceType.name()]}"/>
				</rich:column>

				<rich:column>
					<f:facet name="header">#{messages['intro2.filename']}</f:facet>
					<h:outputText value="#{file.fileName}"/>
				</rich:column>

				<rich:column>
					<a4j:commandLink value="#{messages['intro2.edit']}" onclick="#{rich:component('editPanel')}.show()" reRender="info">
						<f:setPropertyActionListener target="#{transactionHelper.selectedFile}" value="#{archivo}"/>
						<f:setPropertyActionListener target="#{transactionHelper.editMode}" value="1"/>
						<f:setPropertyActionListener target="#{transactionHelper.currentRow}" value="#{row}"/>
					</a4j:commandLink>
					<h:outputText value="  "/>
					<a4j:commandLink value="#{messages['intro2.delete']}" action="#{transactionHelper.deleteSelectedFile}" reRender="tabla">
						<f:setPropertyActionListener target="#{transactionHelper.currentRow}" value="#{row}"/>
					</a4j:commandLink>
				</rich:column>
			</rich:dataTable>
		</h:panelGroup>
		
		<br />
		<a4j:commandLink value="#{messages['intro2.add']}"
				oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editPanel')}.show()" reRender="info">
			<f:setPropertyActionListener value="0" target="#{transactionHelper.editMode}" />
		</a4j:commandLink>

		<br />
		<br />
		<br />

		<a4j:commandButton value="#{messages['intro.next']} >>" action="next"/>
		<a4j:commandButton value="Atras" action="back"/>
	</h:form>

	<rich:modalPanel id="errorPanel" autosized="true">
		<h:outputText value="Corrija uno o mas errores antes de continuar" />		
	</rich:modalPanel>
	
	<ui:include src="/workflow/transaction/includes/attachFiles.xhtml" />
</ui:composition>
